package org.ioc.com.book_test1.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.ioc.com.book_test1.model.BookInfo;

import java.util.List;

@Mapper
public interface BookInfoMapper {
    @Insert("insert into book_info(book_name,author,count,price,publish) " +
            "values(#{bookName},#{author},#{count},#{price},#{publish}) ")
    Integer queryByInsert(BookInfo bookInfo);


    @Select("select * from book_info limit #{offset},#{limit}")
    List<BookInfo> querySelect(Integer offset, Integer limit);
    @Select("select count(*) from book_info")
    Integer count();

    @Select("select * from book_info where id=#{id}")
    BookInfo querySelectById(Integer id);

    Integer queryUpdate(BookInfo bookInfo);

    @Update("update book_info set status=0 where id=#{id}")
    Integer QueryDelete(Integer id);

    Integer queryBatchDelete(List<Integer> id);
}
